/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aljfce.business.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author jacopo
 */
@Embeddable
public class WeatherInformationPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "DayTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dayTime;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 60)
    @Column(name = "Location")
    private String location;

    public WeatherInformationPK() {
    }

    public WeatherInformationPK(Date dayTime, String location) {
        this.dayTime = dayTime;
        this.location = location;
    }

    public Date getDayTime() {
        return dayTime;
    }

    public void setDayTime(Date dayTime) {
        this.dayTime = dayTime;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dayTime != null ? dayTime.hashCode() : 0);
        hash += (location != null ? location.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WeatherInformationPK)) {
            return false;
        }
        WeatherInformationPK other = (WeatherInformationPK) object;
        if ((this.dayTime == null && other.dayTime != null) || (this.dayTime != null && !this.dayTime.equals(other.dayTime))) {
            return false;
        }
        if ((this.location == null && other.location != null) || (this.location != null && !this.location.equals(other.location))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.aljfce.business.entity.WeatherInformationPK[ dayTime=" + dayTime + ", location=" + location + " ]";
    }
    
}
